cow: reconcile the accepted receipt uid against the local derivation - #589
Merged
Conversation
An accepted submit reply's UID is now compared against assembly::order_uid over the submitted order; a disagreement returns VenueError::InvalidBody instead of trusting the mismatched receipt. The already-held path documents that its UID is locally derived and unverified, since that reply carries no UID by design. Closes #559
This was referenced Jul 24, 2026
Closed
mfw78
added a commit
that referenced
this pull request
Jul 25, 2026
…mismatch (#597) The venue-error WIT variant gains two additive, venue-neutral cases for the representable adapter-detected conditions that #589 and #590 had shoved into invalid-body strings: invalid-receipt for an empty or structurally-invalid receipt, and receipt-mismatch for a venue-returned identifier that disagrees with the locally derived one. Both are threaded through the bindgen VenueError, the owned VenueFault mirror and the faults.rs conversions, and the two adapter call sites move off invalid-body onto them so a caller can branch without parsing a message. invalid-body and denied stay as the escape hatch for custom or unrepresentable errors. The change is a purely additive edit to videre:types with no version bump, kept extensible per the pre-cleave freeze policy, so it lands cheaply in the monorepo before the carve. Closes #591
mfw78
added a commit
that referenced
this pull request
Jul 27, 2026
…589) An accepted submit reply's UID is now compared against assembly::order_uid over the submitted order; a disagreement returns VenueError::InvalidBody instead of trusting the mismatched receipt. The already-held path documents that its UID is locally derived and unverified, since that reply carries no UID by design. Closes #559
mfw78
added a commit
that referenced
this pull request
Jul 27, 2026
…mismatch (#597) The venue-error WIT variant gains two additive, venue-neutral cases for the representable adapter-detected conditions that #589 and #590 had shoved into invalid-body strings: invalid-receipt for an empty or structurally-invalid receipt, and receipt-mismatch for a venue-returned identifier that disagrees with the locally derived one. Both are threaded through the bindgen VenueError, the owned VenueFault mirror and the faults.rs conversions, and the two adapter call sites move off invalid-body onto them so a caller can branch without parsing a message. invalid-body and denied stay as the escape hatch for custom or unrepresentable errors. The change is a purely additive edit to videre:types with no version bump, kept extensible per the pre-cleave freeze policy, so it lands cheaply in the monorepo before the carve. Closes #591
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On the accepted submit path,
submit_withnow also computesassembly::order_uid(config.chain, &order, owner)and reconciles it against the UID the orderbook returned; a disagreement surfaces asVenueError::InvalidBodyinstead of being trusted as the receipt. The already-held arms carry a terse note that their UID is locally derived and unverified, since that reply carries no UID by design. A focused unit test covers the mismatch refusal; the existing accept tests already exercise the agreeing case.Closes #559
Why
The already-held path derives its UID client-side, so any drift between the local derivation and the orderbook's assignment would silently split the two accept paths. Reconciling the accepted reply's UID turns such drift into a loud typed failure at the submit seam. This is the cheap option 3 from the issue; the extra GET round trip (option 1) and the widened status view (option 2) stay deferred.
Variant choice for maintainer review: the drift refusal reuses the existing
VenueError::InvalidBody, as the closest invalid-body/internal-inconsistency shape; no WIT orvenue-errorvariant was added.Testing
nix develop --command just cipassed (fmt, clippy, doc, module wasms, workspace tests).nix develop --command just check-venue-agnosticpassed.nix develop --command just check-cow-orderbook-onlypassed.AI Assistance
Implemented with Claude Code.